<?php
/* Class AlignmentObject
 * Documentation can be found at:
* https://github.com/mozilla/openbadges/wiki/Assertions#alignmentobject */

class AlignmentObject {
	
	/* Mandatory fields */
	private $name;
	private $url;
	
	/* Optional fields */
	private $description;
	
	/* Getters & Setters */
	public function getName() {
		return $this->name;
	}
	
	public function setName($name) {
		$this->name = $name;
	}
	
	public function getURL() {
		return $this->url;
	}

	public function setURL($url) {
		$this->url = $url;
	}
	
	public function getDescription() {
		return $this->description;
	}
	
	public function setDescription($description) {
		$this->description = $description;
	}
	
	public function checkValidity() {
		return isset($this->name) && isset($this->url);
	}
	
	public function getArray() {
	
		if (!$this->checkValidity())
			return null;
	
		$array["name"] = $this->name;
		$array["url"] = $this->url;
		
		if (isset($this->description))
			$array["description"] = $this->description;
		
		return $array;
	}
}
?>